<?php

namespace app\admin\model\pt;

use think\Model;


class Order extends Model
{





    // 表名
    protected $name = 'pt_order';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'pt_grade_text'
    ];

    public function getPtGradeTextAttr($value, $data)
    {   //Z助工 ,M中工 ,G高工 ,P 正高
        $value = $value ? $value : $data['pt_grade'];
        $list = ['Z' => '助工', 'M' => '中工', 'G' => '高工', 'P' => '正高'];
        return $list[$value] ?? '';
    }

    public function getOrderSourceList()
    {
        return [
            '1' => '手工录入',
            '2' => '小程序',
            '3' => 'app'
        ];
    }

    public function getUserSourceList()
    {
        return [
            '1' => '本年新进',
            '2' => '上年结转',
            '3' => '他组转移'
        ];
    }

    public function getPtOrderLevelList()
    {
        return [
            '1' => '资料',
            '2' => '包过'
        ];
    }

    public function getReviewFormStatusList()
    {
        return [
            '0' => '未取回',
            '1' => '取回',
            '2' => '已寄送'
        ];
    }

    public function getOrderStatusList()
    {
        return [
            '1' => '新增',
            '2' => '主管审核',
            '3' => '准备',
            '4' => '定稿',
            '5' => '资格审查通过',
            '9' => '未通过',
            '10' => '未定稿退费',
            '11' => '已定稿退费'
        ];
    }

    public function getWorkDetailStatusList()
    {
        return [
            '1' => '待编辑',
            '2' => '待处理',
            '3' => '待归档',
            '4' => '待验收',
            '5' => '待发布',
            '6' => '已发布'
        ];
    }




    public function jobs()
    {
        return $this->hasMany('Job', 'order_id', 'id');
    }



    public function series()
    {
        return $this->belongsTo('Series', 'series_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }



}
